package gui;

import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.swing.*;

import util.ImageLoader;

public class ControlPanel extends JPanel {

	private static final long serialVersionUID = -1052322967210334458L;

	private BufferedImage background;
	
	public ControlPanel(MouseControlPanel mouseControlPanel, CameraControlPanel cameraControlPanel, SaveLoadPanel saveLoad) {
		this.setLayout(new BorderLayout());
		this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
		Box box = Box.createHorizontalBox();
		box.add(mouseControlPanel.getPanel());
		box.add(Box.createHorizontalStrut(5));
		box.add(cameraControlPanel.getButton());
		box.add(Box.createHorizontalStrut(5));
		box.add(Box.createHorizontalGlue());
		box.add(saveLoad.getPanel());
		box.setOpaque(false);
		this.add(box, BorderLayout.CENTER);
		ImageLoader loader = new ImageLoader("/resource/image/background/");
		background = loader.load("background.png");
	}
	
	@Override
	public void paintComponent(Graphics g) {
		g.drawImage(background, 0, 0, this.getWidth(), background.getHeight(), null);
	}
}
